import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'

import Home from '@/views/Home.vue'
import About from '@/views/About.vue'
import paramsTemplate from '@/views/demo/param_template.vue'
import fnTemplate from '@/views/demo/fn_template.vue'
import eventTemplate from '@/views/demo/event_template.vue'
import formTemplate from '@/views/demo/form_template.vue'

// import NotFound from './404.vue'

console.log(About)

// 定义路由
const routes = [
    { path: '/', name: "Home", title: "Home", component: Home },
    { path: '/about', name: "About", component: About },
    { path: '/fn', component: fnTemplate },
    { path: '/form', component: formTemplate },
    { path: '/event', component: eventTemplate },
    { 
        path: '/params', 
        component: paramsTemplate , props:{ 
            pString: 'Hello Vue',
            pNumber: 19820725,
            pBoolean: true,
            pNumRequired: 19860627,
            pArray: [{name: 'A', sex: 1, age: 18}, {name: 'B', sex: 0, age: 18}, {name: 'C', sex: 1, age: 19}]
        }
    }
]

// const router = createRouter({
//     // 4. 内部提供了 history 模式的实现。为了简单起见，我们在这里使用 hash 模式。 hash 模式会加 # 号 createWebHashHistory
//     history: createWebHistory(),
//     routes
// })

const router= createRouter({
    history: createWebHistory(),
    routes
})

export default router
